<?php

namespace App\Service\Common;

use App\Enums\Common\MerchantEnum;
use App\Models\Fee\FeeAnnualOrderModel;

class MerchantService
{

    /**
     * 获得注意条从
     * @param int $shopId
     * @return array
     */
    public static function getNoticeList(int $shopId)
    {
        //NOTICE_TYPE_1 年费订单
        $list = [];
        $feeOrderModel = FeeAnnualOrderModel::query()
            ->where('shopId', $shopId)
            ->whereIn('payStatus', [FeeAnnualOrderModel::PAY_STATUS_WAIT, FeeAnnualOrderModel::PAY_STATUS_PART]);

        $feeCount = $feeOrderModel->count();
        if ($feeCount) {
            $list[] = [
                //'type'  => MerchantEnum::NOTICE_TYPE_1,    //用来区分消息类型是注意还是提醒
                'text'  => '您有' . $feeCount . '笔年费订单待支付，点击查看详情',
                'value' => $feeOrderModel->pluck('feeOrderNo')->toArray(),
            ];
        }

        return $list;
    }
}
